#include<cstdio>
#include<algorithm>
#define N 100010
#define ls (p<<1)
#define rs (ls|1)
#define mid ((l+r)>>1)
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
using namespace std;
int n,ans,Min;
struct flight
{
	int l[N],r[N],p[N],f[N],Mn[N<<2],m;
	void modify(int p,int l,int r,int x,int v)
	{
		if (l==r) return (void)(Mn[p]=v);
		x<=mid?modify(ls,l,mid,x,v):modify(rs,mid+1,r,x,v);
		Mn[p]=min(Mn[ls],Mn[rs]);
	}
	int find(int p,int l,int r,int x)
	{
		if (l==r) return l;
		if (Mn[ls]<x) return find(ls,l,mid,x);
		if (Mn[rs]<x) return find(rs,mid+1,r,x);
		return 0;
	}
	void read()
	{
		for (int i=1;i<=m;++i) 
			scanf("%d%d",&l[p[i]=i],&r[i]);
	}
	void query()
	{
		for (int i=1;i<=m;++i)
		{
			int x=find(1,1,n,l[p[i]]);
			if (x) ++f[x],modify(1,1,n,x,r[p[i]]);
		}
		for (int i=1;i<=n;++i) f[i]+=f[i-1];
	}
} A,B;
bool cmpA(int x,int y) {return A.l[x]<A.l[y];}
bool cmpB(int x,int y) {return B.l[x]<B.l[y];}
int main()
{
	freopen("airport.in","r",stdin);
	freopen("airport.out","w",stdout);
	scanf("%d%d%d",&n,&A.m,&B.m);
	A.read(),B.read();
	sort(A.p+1,A.p+A.m+1,cmpA);
	sort(B.p+1,B.p+B.m+1,cmpB);
	A.query(),B.query();
	for (int i=0;i<=n;++i) ans=max(ans,A.f[i]+B.f[n-i]);
	printf("%d",ans);
	return 0;
}
